package com.avengers.core.bean.enums;

/**
 * @author yu.wang
 * @since 2018-04-26 下午4:56
 */
public enum ApiResponseCode {
    /**
     * response code
     */
    SUCCESS("200", "成功"),
    SUCCESS_BEHIND("201", "成功但未领先"),
    DEAL("210", "处理中"),
    FAIL("400", "失败"),
    /**
     * 可以展示给用户的错误
     */
    FAIL_TO_USER("401", "处理失败"),
    /**
     * 无需重试的错误
     */
    FAIL_FOREVER("402", "失败"),
    /**
     * 等待用户处理的错误
     */
    WAIT_FOR_USER("800", "等待处理"),
    /**
     * 不对用户显示错误
     */
    WAIT_FOR_ADMIN("801", "等待管理员处理"),
    AUTHORIZATION_ERROR("300", "无权访问"),
    PARAMS_MISSING("301", "丢失参数"),
    PARAMS_NOT_VALID("302", "参数格式错误"),
    REPEAT_CONFIRM("303", "重复提交"),
    OBJECT_NOT_FOUND("304", "未找到指定对象"),
    NOT_FOUND("404", "未找到记录值"),
    SERVER_ERROR("500", "系统异常"),
    TIME_OUT("507", "请求超时"),
    DB_ERROR("601", "操作数据库错误"),
    DB_EXCEPTION("602", "数据库抛异常"),
    PARAMS_ERROR("505", "参数异常"),
    NOT_SUPPORT("900", "不支持该接口");

    public final String code;
    public final String message;

    ApiResponseCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return this.code;
    }

    public String getMessage() {
        return message;
    }
}
